var e = require, t = module, n = exports;

Object.defineProperty(n, "__esModule", {
    value: !0
});

var o = e("GameData"), i = e("Global"), a = e("LoadManager"), r = function() {
    function n() {
        this.bgId = null;
    }
    return n.getInstance = function() {
        return this._manager || (this._manager = new n()), this._manager;
    }, n.prototype.playBg = function(n) {
        o.GD.isSound==false && a.default.getInstance().loadRes({
            url: i.G.audioPath + "/" + n,
            type: cc.AudioClip
        }).then(function(n) {
            n instanceof cc.AudioClip && (cc.audioEngine.stopMusic(), cc.audioEngine.playMusic(n, !0));
        });
    }, n.prototype.pauseBg = function() {
        cc.audioEngine.pauseMusic();
    }, n.prototype.resumeBg = function() {
        cc.audioEngine.resumeMusic();
    }, n.prototype.playAudio = function(n, u, e) {
        return void 0 === u && (u = 1), void 0 === e && (e = 0), new Promise(function(e, t) {
            o.GD.isSound ? a.default.getInstance().loadRes({
                url: i.G.audioPath + "/" + n,
                type: cc.AudioClip
            }).then(function(n) {
                n instanceof cc.AudioClip ? e(cc.audioEngine.play(n, !1, u)) : t();
            }).catch(function() {
                t();
            }) : t();
        });
    }, n.prototype.getAudio = function(n, e) {
        a.default.getInstance().loadRes({
            url: i.G.audioPath + "/" + n,
            type: cc.AudioClip
        }).then(function(n) {
            null == e || e(n);
        }).catch(function() {
            null == e || e(null);
        });
    }, n._manager = null, n;
}();

n.default = r;